# # encoding=utf-8
# # author:梁子龙
# import time
# from datetime import timedelta
# from celery import Celery
# from celery.schedules import crontab
# backend = 'redis://127.0.0.1:6379/1'  # 结果存储
# broker = 'redis://127.0.0.1:6379/2'  # 消息中间件
# # app=Celery(‘任务名’, broker=’xxx’, backend=’xxx’)
# app = Celery('v_lzlgliang', broker=broker, backend=backend)  # 传一个字符串，相当于名字
# app.conf.timezone = 'Asia/Shanghai'
# # 是否使用UTC
# app.conf.enable_utc = False
#
# # celery -A proj.celery_tasks  worker -l info -P gevent
# # @app.task
# # def add(a, b):  # 很耗时的任务
# #     return a + b
#
#
# # celery -A tasks worker -l info -P gevent
# @app.task
# def send(x, y):
#     time.sleep(5)
#     res = x + y
#     print('计算出的结果是:{}'.format(res))
#     print('完成任务调用')
#     return res


# app.conf.beat_schedule = {
#     'update_model': {
#         'task': 'celery_tasks.home_task.arrange_task',  # 要执行的任务
#         'schedule': timedelta(seconds=5),
#         # 'schedule': crontab(hour=8, day_of_week=1),  # 每周一早八点
#         'args': (),
#     },
#     # 'add_3': {
#     #     'task': 'celery_tasks.home_task.add',  # 要执行的任务
#     #     'schedule': timedelta(seconds=3),
#     #     # 'schedule': crontab(hour=8, day_of_week=1),  # 每周一早八点
#     #     'args': (6, 8),
#     # }
# }
